<?php
/**
 * 订单商品表
 * Created by PhpStorm.
 * User: sunku
 * Date: 2018/05/11
 * Time: 09:42
 */

namespace Resource\Service;
use Think\Model;

class OrderLogService extends Model
{
    protected $trueTableName = 'wz_order_log';

    /**
     * 添加订单日志
     * @param $params
     * @return mixed
     */
    public function addOrderLog($params){
        return D('Resource/OrderLog')->addOrderLog($params);
    }
    /**
     * 获取日志不分页
     *
     * @param [type] $params
     * @return mixed
     */
    public function getAllOrderLog($params){
        $result = D('Resource/OrderLog')->getAllOrderLog($params);
        if(is_array($result) && count($result)>0){
            foreach($result as $key=>$val){
                $result[$key]['admin_name'] = "";
                $result[$key]['department_name'] = "";
                $user = D('Resource/User','Service')->getUserInfo(['id'=>$val['admin_id']]);
                if(isset($user) && $user){
                    $result[$key]['admin_name'] = $user['name'];
                    $result[$key]['department_name'] = $user['department_name'];
                }
                $result[$key]['add_time'] = date("Y-m-d H:i:s",$val['create_time']);
            }
                
        }
        return $result;
    }
}